﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="GridViewEditCell.aspx.cs" Inherits="GridViewEditCell" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Editing individual GridView cells</title>  
    <link href="css/basic.css" rel="stylesheet" type="text/css" />  
</head>
<body>
    <form id="form1" runat="server">
       
    <p>
        <asp:LinkButton runat="server" ID="AddRow" Text="Add Row" OnClick="AddRow_Click"></asp:LinkButton>
    </p>
    <p style="top: 269px; left: 4px; position: absolute; height: 19px; width: 1189px">
        &nbsp;</p>
    <div>        
        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
            CellPadding="4" ForeColor="#333333" GridLines="None"
            OnRowDataBound="GridView1_RowDataBound" 
            OnRowCommand="GridView1_RowCommand" OnRowUpdating="GridView1_RowUpdating" 
            ShowFooter="True">
            <Columns>                
                <asp:ButtonField Text="SingleClick" CommandName="SingleClick" Visible="False"/>
                <asp:TemplateField HeaderText="Id">
                    <ItemTemplate>
                        <asp:Label ID="IdLabel" runat="server" Text='<%# Eval("Id") %>'></asp:Label>                        
                    </ItemTemplate>               
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Task">
                    <ItemTemplate>
                        <asp:Label ID="DescriptionLabel" runat="server" Text='<%# Eval("Description") %>'></asp:Label>
                        <asp:TextBox ID="Description" runat="server" Text='<%# Eval("Description") %>' Width="175px" visible="false"></asp:TextBox>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Assigned To">
                    <ItemTemplate>
                        <asp:Label ID="AssignedToLabel" runat="server" Text='<%# Eval("AssignedTo") %>'></asp:Label>
                        <asp:DropDownList ID="AssignedTo" runat="server" Visible="false" 
                            CausesValidation="true">
                           
                        </asp:DropDownList>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Status">
                    <ItemTemplate>
                        <asp:Label ID="StatusLabel" runat="server" Text='<%# Eval("Status") %>'></asp:Label>
                        <asp:DropDownList ID="Status" runat="server" Visible="false" AutoPostBack="true" CausesValidation="true">
                            <asp:ListItem>Pending</asp:ListItem>
                            <asp:ListItem>In Progress</asp:ListItem>
                            <asp:ListItem>Complete</asp:ListItem>
                            <asp:ListItem>Cancelled</asp:ListItem>
                            <asp:ListItem>Suspended</asp:ListItem>
                        </asp:DropDownList>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Tick">
                    <ItemTemplate>
                        <asp:Label ID="TickLabel" runat="server" Text='<%# Eval("Tick") %>'></asp:Label>
                        <asp:CheckBox ID="Tick" runat="server" Visible="false" AutoPostBack="true" />
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
            <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
            <HeaderStyle CssClass="headerStyle" ForeColor="White" BackColor="#5D7B9D" 
                Font-Bold="True" />
            <RowStyle CssClass="rowStyle" BackColor="#F7F6F3" ForeColor="#333333" />
            <EditRowStyle BackColor="#999999" />
            <AlternatingRowStyle CssClass="alternatingRowStyle" BackColor="White" 
                ForeColor="#284775" />
            <FooterStyle CssClass="footerStyle" BackColor="#5D7B9D" Font-Bold="True" 
                ForeColor="White" />
            <PagerStyle CssClass="pagerStyle" ForeColor="White" BackColor="#284775" 
                HorizontalAlign="Center" />
        </asp:GridView>
        <br /><br />
        <asp:Label id="Message" runat="server" CssClass="message"></asp:Label>        
     </div>
    <p>
        <asp:LinkButton runat="server" ID="Remove" Text="Remove Row" OnClick="Remove_Click"></asp:LinkButton>
    </p>
    </form>
</body>
</html>
